﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class OutstandingQtyW
    {
        int outstandingID;
        string deptID;
        string itemCode;
        int outstandingQty;
        string status;

        [DataMember]
        public int OutstandingID
        {
            get { return outstandingID; }
            set { outstandingID = value; }
        }

        [DataMember]
        public string DeptID
        {
            get { return deptID; }
            set { deptID = value; }
        }

        [DataMember]
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }

        [DataMember]
        public int OutstandingQty
        {
            get { return outstandingQty; }
            set { outstandingQty = value; }
        }

        [DataMember]
        public string Status
        {
            get { return status; }
            set { status = value; }
        }

        public static OutstandingQtyW convert(OutstandingQty outstandingQty)
        {
            OutstandingQtyW u = new OutstandingQtyW();

            u.OutstandingID = outstandingQty.OutstandingID;
            u.DeptID = outstandingQty.DeptID;
            u.ItemCode = outstandingQty.ItemCode;
            u.OutstandingQty = outstandingQty.OutstandingQty1.GetValueOrDefault();
            u.Status = outstandingQty.Status;
            return u;
        }

        public static List<OutstandingQtyW> convertList(List<OutstandingQty> list)
        {
            List<OutstandingQtyW> listW = new List<OutstandingQtyW>();

            foreach (OutstandingQty x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}